import Vue from 'vue'
import Router from 'vue-router'
// import Home from './views/Home.vue'

const Home = resolve => {
  require.ensure(['./views/Home'], () => {
      resolve(require('./views/Home'))
  })
}
const Login = resolve => {
  require.ensure(['./views/login/Login'], () => {
      resolve(require('./views/login/Login'))
  })
}
const Activity = resolve => {
  require.ensure(['./views/activity/Activity'], () => {
      resolve(require('./views/activity/Activity'))
  })
}
const ActSettings = resolve => {
  require.ensure(['./views/actSettings/ActSettings'], () => {
      resolve(require('./views/actSettings/ActSettings'))
  })
}
const NewActivities = resolve => {
  require.ensure(['./views/actSettings/NewActivities'], () => {
      resolve(require('./views/actSettings/NewActivities'))
  })
}
const NewBasics = resolve => {
  require.ensure(['./views/actSettings/NewBasics'], () => {
      resolve(require('./views/actSettings/NewBasics'))
  })
}
const NewRules = resolve => {
  require.ensure(['./views/actSettings/NewRules'], () => {
      resolve(require('./views/actSettings/NewRules'))
  })
}
const NewRuleCashback = resolve => {
  require.ensure(['./views/actSettings/NewRuleCashback'], () => {
      resolve(require('./views/actSettings/NewRuleCashback'))
  })
}
const NewRulesSale = resolve => {
  require.ensure(['./views/actSettings/NewRulesSale'], () => {
      resolve(require('./views/actSettings/NewRulesSale'))
  })
}
const NewPrize = resolve => {
  require.ensure(['./views/actSettings/NewPrize'], () => {
      resolve(require('./views/actSettings/NewPrize'))
  })
}
const NewCashback = resolve => {
  require.ensure(['./views/actSettings/NewCashback'], () => {
      resolve(require('./views/actSettings/NewCashback'))
  })
}
const NewStation = resolve => {
  require.ensure(['./views/actSettings/NewStation'], () => {
      resolve(require('./views/actSettings/NewStation'))
  })
}
const NewGroup = resolve => {
  require.ensure(['./views/actSettings/NewGroup'], () => {
      resolve(require('./views/actSettings/NewGroup'))
  })
}
const Group = resolve => {
  require.ensure(['./views/group/Group'], () => {
      resolve(require('./views/group/Group'))
  })
}
const Discount = resolve => {
  require.ensure(['./views/discount/Discount'], () => {
      resolve(require('./views/discount/Discount'))
  })
}
const RedTotal = resolve => {
  require.ensure(['./views/discount/RedTotal'], () => {
      resolve(require('./views/discount/RedTotal'))
  })
}
const CashBack = resolve => {
  require.ensure(['./views/discount/CashBack'], () => {
      resolve(require('./views/discount/CashBack'))
  })
}
const Gift = resolve => {
  require.ensure(['./views/gift/Gift'], () => {
      resolve(require('./views/gift/Gift'))
  })
}
const ActStatistics = resolve => {
  require.ensure(['./views/actStatistics/ActStatistics'], () => {
      resolve(require('./views/actStatistics/ActStatistics'))
  })
}
const ActRed = resolve => {
  require.ensure(['./views/actStatistics/ActRed'], () => {
        resolve(require('./views/actStatistics/ActRed'))
  })
}
const ActCashBack = resolve => {
  require.ensure(['./views/actStatistics/ActCashBack'], () => {
        resolve(require('./views/actStatistics/ActCashBack'))
  })
}
const News = resolve => {
  require.ensure(['./views/news/News'], () => {
      resolve(require('./views/news/News'))
  })
}
const ActivityDone = resolve => {
  require.ensure(['./views/actSettings/ActivityDone'], () => {
      resolve(require('./views/actSettings/ActivityDone'))
  })
}
const SettingIndex = resolve => {
  require.ensure(['./views/actSettings/SettingIndex'], () => {
      resolve(require('./views/actSettings/SettingIndex'))
  })
}
const ActStatement = resolve => {
  require.ensure(['./views/actSettings/ActStatement'], () => {
      resolve(require('./views/actSettings/ActStatement'))
  })
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    // {
    //   path: '/',
    //   name: 'home',
    //   component: Home
    // },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/activity',
      name: 'Activity',
      component: Activity,
      children:[
        {
          path: '/actSettings',
          name: 'ActSettings',
          component: ActSettings
        },
        {
          path: '/actStatement',
          name: 'ActStatement',
          component: ActStatement
        },
        {
          path: '/settingIndex',
          name: 'SettingIndex',
          component: SettingIndex,
          children:[
            {
              path:'newActivities',
              component: NewActivities
            },
            {
              path:'newBasics',
              component: NewBasics
            },
            {
              path:'newRules',
              component: NewRules
            },
            {
              path:'newRulesSale',
              component: NewRulesSale
            },
            {
              path:'newRuleCashback',
              component: NewRuleCashback
            },
            {
              path:'activityDone',
              component: ActivityDone
            },
            {
              path: 'newPrize',
              component: NewPrize
            },
            {
              path: 'newCashback',
              component: NewCashback
            },
            {
              path: 'newStation',
              component: NewStation
            },
            {
              path: 'newGroup',
              component: NewGroup
            },
          ]
        },
        // {
        //   path: '/newStation',
        //   name: 'NewStation',
        //   component: NewStation
        // },
        // {
        //   path: '/newGroup',
        //   name: 'NewGroup',
        //   component: NewGroup
        // },
        {
          path: '/group',
          name: 'Group',
          component: Group
        },
        {
          path: '/discount',
          name: 'Discount',
          component: Discount
        },
        {
          path: '/redTotal',
          name: 'RedTotal',
          component: RedTotal
        },
        {
          path: '/cashBack',
          name: 'CashBack',
          component: CashBack
        },
        {
          path: '/gift',
          name: 'Gift',
          component: Gift
        },
        {
          path: '/actStatistics',
          name: 'ActStatistics',
          component: ActStatistics
        },
        {
          path: '/actRed',
          name: 'ActRed',
          component: ActRed
        },
        {
          path: '/actCashBack',
          name: 'actCashBack',
          component: ActCashBack
        },
        {
          path: '/news',
          name: 'News',
          component: News
        }    
      ]
    },
  ]
})
